﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace TKT.Lifter.CIM.Lifter.TibcoMsg.Lifter
{
    public class TransferCommandEventReport : MessageBody
    {
        public string MachineName { get; set; }
        public string CommandID { get; set; }
        public string CarrierID { get; set; }
        public string CarrierLocation { get; set; }
        public string Destination { get; set; }
        public string ResultCode { get; set; }
        public string EventID { get; set; }

        public TransferCommandEventReport()
            : base("TransferCommand")
        { }

        public override System.Xml.Linq.XElement ToXElement()
        {
            XElement body = new XElement("Body");
            body.Add(new XElement("MACHINENAME", this.MachineName));
            body.Add(new XElement("COMMANDID", this.CommandID));
            body.Add(new XElement("CARRIERID", this.CarrierID));
            body.Add(new XElement("CARRIERLOC", this.CarrierLocation));
            body.Add(new XElement("DEST", this.Destination));
            body.Add(new XElement("RESULTCODE", this.ResultCode));
            body.Add(new XElement("EVENTID", this.EventID));
            return body;
        }

        public override void Parse(System.Xml.Linq.XElement body)
        {
            this.MachineName = body.Element("MACHINENAME").Value;
            this.CommandID = body.Element("COMMANDID").Value;
            this.CarrierID = body.Element("CARRIERID").Value;
            this.CarrierLocation = body.Element("CARRIERLOC").Value;
            this.Destination = body.Element("DEST").Value;
            this.ResultCode = body.Element("RESULTCODE").Value;
            this.EventID = body.Element("EVENTID").Value;
        }
    }
}
